package net.minecraft.src;

import java.util.Random;

public abstract class EntityWaterThing extends EntityCreature
{

public void onLivingUpdate()
{
	if(posY != 0) //Resolves a bug after restating the game!
	{
		int spawnX = 0;
		if(spawnX == 0)
		{
			spawnX = (int) posX;
			double spawnY = posY;
			double spawnZ = posZ;
		}
		int randomY = 0;
		if((int)posY == randomY || randomY == 56)
			newY();
		else
		{
			if(posY > randomY)
			{
				motionY = -0.05F;
				if(posY + motionY < randomY)
					motionY = randomY - posY;
			}
			else
			{
				motionY = 0.05F;
				if(posY + motionY > randomY)
					motionY = randomY - posY;
			}
		}
		int randomX = 0;
		if((int)posX == randomX || randomX == 0)
			newY();
		else
		{
			if(posX > randomX)
			{
				motionX = -0.1F;
				if(posX + motionX < randomX)
					motionX = randomX - posX;
			}
			else
			{
				motionX = 0.1F;
				if(posX + motionX > randomX)
					motionX = randomX - posX;
			}
		}
		int randomZ = 0;
		if((int)posZ == randomZ || randomZ == 0)
			newY();
		else
		{
			if(posZ > randomZ)
			{
				motionZ = -0.1F;
				if(posZ + motionZ < randomZ)
					motionZ = randomZ - posZ;
			}
			else
			{
				motionZ = 0.1F;
				if(posZ + motionZ > randomZ)
					motionZ = randomZ - posZ;
			}
		}
    	float aimRotation = 0;
		float rotSpeed = 0;
		if(rotationYaw < aimRotation)
    	{
    		if(rotationYaw + rotSpeed < aimRotation)
    			renderYawOffset = rotationYaw += rotSpeed;
    		else
    			renderYawOffset = rotationYaw = aimRotation;
    	}
    	else
    	{
    		if(rotationYaw - rotSpeed > aimRotation)
    			renderYawOffset = rotationYaw -= rotSpeed;
    		else
    			renderYawOffset = rotationYaw = aimRotation;
    	}
	}
}

private void newY() {}{}
	// TODO Auto-generated method stub
	

    public EntityWaterThing(World world)
    {
        super(world);
    }

    public boolean canBreatheUnderwater()
    {
        return true;
    }

    public void writeEntityToNBT(NBTTagCompound nbttagcompound)
    {
        super.writeEntityToNBT(nbttagcompound);
    }

    public void readEntityFromNBT(NBTTagCompound nbttagcompound)
    {
        super.readEntityFromNBT(nbttagcompound);
    }

    public boolean getCanSpawnHere()
    {
        return worldObj.checkIfAABBIsClear(boundingBox);
    }

    public int getTalkInterval()
    {
        return 120;
    }

    protected boolean canDespawn()
    {
        return true;
    }

    protected int getExperiencePoints(EntityPlayer entityplayer)
    {
        return 1 + worldObj.rand.nextInt(3);
    }
}
